import { ADD_LIST, SET_LIST_TEXT, SET_FIlTER, TOGGLE_STATE } from './actionTypes' 

/**
 * 新增待办列表项
 * @param {x} text
 */
let nextListId = 0
export const addList = (text) => ({
    type: ADD_LIST,
    id: nextListId++,
    text
})

/**
 * 更改待办事项状态
 * @param {x} id
 */
export const toggleState = (id) => ({
    type: TOGGLE_STATE,
    id
})

/**
 * 设置过滤状态
 * @param {x} filter
 */
export const setFilter = (filter) => ({
    type: SET_FIlTER,
    filter
})

/**
 * 新增待办列表的文本
 * @param {x} text
 */
export const setListText = (text) => ({
    type: SET_LIST_TEXT,
    text
})

